package fatworm.query.constant;

public class IntConstant implements Constant {
	
	private Integer val;
	
	public IntConstant(Integer val) {
		this.val = val;
	}
	
	public Object asJavaVal() {
		return val;
	}
	
	public boolean equals(Object obj) {
		IntConstant ic = (IntConstant)obj;
		if (ic != null && val.equals(ic.val))
			return true;
		else
			return false;
	}
	
	public int compareTo(Constant c) {
		IntConstant ic = (IntConstant)c;
		return val.compareTo(ic.val);
	}
	
	public int hashCode() {
		return val.hashCode();
	}
	
	public String toString() {
		return val.toString();
	}
	
	public Constant plus(Constant c) {
		IntConstant ic = (IntConstant)c;
		return new IntConstant(val + ic.val);
	}
}